//
//  SeeVideoDetailViewController.m
//  Zaker
//
//  Created by lirui on 16/3/10.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "SeeVideoDetailViewController.h"

@interface SeeVideoDetailViewController ()

@end

@implementation SeeVideoDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [ UIColor whiteColor];
    
    NSLog(@"%@",_sModel);
    self.navigationItem.leftBarButtonItem = [[ UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"iconfont-newlisticon06"] style:UIBarButtonItemStylePlain target:self action:@selector(back)];
    [self data];
    

}
-(void)viewWillAppear:(BOOL)animated
{
    
    self.tabBarController.tabBar.hidden = YES;
}
-(void)viewWillDisappear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden = NO;
}
-(void)data
{
       NSString *str = [NSString stringWithFormat:@"http://c.m.163.com/nc/video/detail/%@.html", _sModel.vid];
    [LHAFNetworkTool getUrl:str body:nil response:LHJSON requestHeadFile:nil success:^(NSURLSessionDataTask *task, id resposeObject) {
        NSString *path = resposeObject[@"vurl"];
        self.pathstr = path;
        
        UIWebView *webVC = [[UIWebView alloc]initWithFrame:CGRectMake(0, -90, self.view.frame.size.width, self.view.frame.size.height + 75)];
        webVC.backgroundColor = [UIColor yellowColor];
        [self.view addSubview:webVC];
        //    if ([BlackManager sharedInstance].isNight) {
        //        [webVC stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName(‘body‘)[0].style.background=‘#F6F7F3‘"];
        //    }
        //webView适应
        webVC.scalesPageToFit = YES;
        webVC.scrollView.bounces = NO;
        if (_pathstr.length != 0) {
            [webVC loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_pathstr]]];
        }else{
            
            [webVC loadHTMLString:_pathhtml baseURL:[NSURL URLWithString:_pathhtml]];
        }

    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        
    }];
}
-(void)back
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
